<template>
	<view>
		<view class="top"></view>
		<view class="logout" @click="show1=true">退出登录</view>
		<view class="content">
			<view class="title">
				冻结提示
			</view>
			<view class="text">
				您的账户目前处在冻结状态，此状态下无法对软件进行其它操作
			</view>
			<view class="text">
				等待委托服务方进行处理，过错方账号将被冻结，并扣除信用
			</view>
		</view>
		<image @click="toPage('/pages/htmlB/farm/fruits')" src="../../static/image/a10.png" class="image"></image>
		<view class="button" v-if="type!='WAIT_ADMIN_EXAMINE_TRADE'">
			<button type="default" @click="show=true" class="b1">{{price}}蜜贝 解冻</button>
		</view>
		<view class="button" v-else>
			<button type="default" class="b2">等待解冻</button>
		</view>
		<u-modal @confirm="applyRelieveFrozen" v-model="show" :showTitle="false" :showCancelButton="true"
			:content="'是否花费'+price+'蜜贝 解冻'"></u-modal>
		<u-modal @confirm="logout" v-model="show1" :showTitle="false" :showCancelButton="true" :content="content">
		</u-modal>
	</view>
</template>

<script>
	var than;
	export default {
		data() {
			return {
				show: false,
				show1: false,
				content: '是否退出登录',
				type: "",
				price: 0
			}
		},
		onLoad(option) {
			than = this;
			than.post("api/kmb/coldStatus", null, function(data) {
				than.type = data.cold_type;
				than.price = data.price
				than.user_kmb=data.user_kmb;
			})
		},
		methods: {
			applyRelieveFrozen() {
				var sub = than.sub(than.price, than.user_kmb);
				if (sub > 0) {
					uni.navigateTo({
						url: 'v-index?real_number=' + sub
					})
				}else{
					than.post("api/kmb/applyRelieveFrozen", null, function(data) {
						than.toast("申请成功，等待后台审核")
					})
				}
			},
			logout() {
				than.post("api/kmb/logout", null, function(data) {
					than.toast("退出成功")
					uni.clearStorageSync();
					setTimeout(function() {
						than.toLogin();
					}, 1000);
				})
			}
		}
	}
</script>

<style lang="less">
	.logout {
		position: fixed;
		right: 0;
		top: 110rpx;
		width: 130rpx;
		height: 54rpx;
		background: rgba(0, 0, 0, 0.45);
		border-radius: 27rpx 0px 0px 27rpx;
		font-size: 24rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.top {
		height: 879rpx;
		background-image: url(../../static/image/a9.png);
		background-size: 100% 100%;
	}

	.image {
		position: fixed;
		bottom: 71rpx;
		width: 74rpx;
		height: 74rpx;
		right: 32rpx;
		bottom: 237rpx;
	}

	.button {
		position: fixed;
		bottom: 71rpx;
		width: 100%;

		button {
			width: 314rpx;
			height: 80rpx;
			line-height: 80rpx;
			border-radius: 40rpx;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
		}

		.b1 {
			background: #FEC31D;
		}

		.b2 {
			background: #AAAAAA;
		}
	}

	.content {
		margin: -500rpx 29rpx auto;
		height: 700rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 0 45rpx;

		.title {
			text-align: center;
			height: 150rpx;
			line-height: 150rpx;
			font-size: 60rpx;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FD7418;
		}

		.text {
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			line-height: 48rpx;
			margin-bottom: 50rpx;
		}
	}
</style>
